#!/usr/bin/env python

#../../google_appengine/appcfg.py update ./
#../../google_appengine/dev_appserver.py ./
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp import util

# my own class
from mops import DataRetrieveHandler


import common_utils
from query_database_gui import QueryDatabaseGUIMainHandler

class MainHandler(webapp.RequestHandler):
	def get(self):
		if common_utils.check_login():
			context = {
				"user": "aaa",
			}
			self.response.out.write(template.render("template/index.html", context))
		else: self.redirect(users.create_login_url(self.request.uri))

def main():
	application = webapp.WSGIApplication([
		('/', MainHandler),
		('/data_retrieve', DataRetrieveHandler),
		('/query_database_gui', QueryDatabaseGUIMainHandler)],
		debug=True)
	util.run_wsgi_app(application)

if __name__ == '__main__':
	main()
